<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>vincr</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="vibrato.html" title="vibrato" />
    <link rel="next" href="vlimit.html" title="vlimit" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">vincr</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="vibrato.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="vlimit.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="vincr"></a>
      <div class="titlepage"></div>
      <a id="IndexVincr" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">vincr</span>
        </h2>
        <p>vincr — 
      Accumulates audio signals.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp164500768"></a>
        <h2>Description</h2>
        <p>
      <span class="emphasis"><em>vincr</em></span> increments one audio variable with another signal, i.e. it accumulates output.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp164502400"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>vincr</strong></span> accum, aincr</pre>
      </div>
      <div class="refsect1">
        <a id="idp164504448"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>accum</em></span> -- audio-rate accumulator variable to be incremented 
    </p>
        <p>
      <span class="emphasis"><em>aincr</em></span> -- incrementing signal 
    </p>
        <p>
      <span class="emphasis"><em>vincr</em></span> (variable increment) and <a class="link" href="clear.html" title="clear"><em class="citetitle">clear</em></a> are intended to be used together. <span class="emphasis"><em>vincr</em></span> stores the result of the sum of two audio variables into the first variable itself (which is intended to be used as an accumulator in polyphony). The accumulator is typically a global variable that is used to combine signals from several sources (different instruments or instrument instances) for further processing (for example, via a global effect that reads the accumulator) or for outputting the combined signal by some means other than one of the <span class="emphasis"><em>out</em></span> opcodes (eg. via the <a class="link" href="fout.html" title="fout"><em class="citetitle">fout</em></a> opcode). After the accumulator is used, the accumulator variable should be set to zero by means of the <span class="emphasis"><em>clear</em></span> opcode (or it will explode).
    </p>
      </div>
      <div class="refsect1">
        <a id="idp164511536"></a>
        <h2>Examples</h2>
        <p>
      The following example uses the vincr opcode. It uses the file <a class="ulink" href="examples/vincr.csd" target="_top"><em class="citetitle">vincr.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp164513392"></a>
          <p class="title">
            <strong>Example 1002. Example of the vincr opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac     <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if RT audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o vincr.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

gaReverb <span class="opc">init</span> 0

<span class="oblock">instr</span> 1
    
idur	<span class="op">=</span> p3
kpitch	<span class="op">=</span> p4
a1	<span class="opc">diskin2</span>	"fox.wav", kpitch
a1	<span class="op">=</span> a1<span class="op">*</span>.5			<span class="comment">;reduce volume</span>
	<span class="opc">vincr</span>	gaReverb, a1
<span class="oblock">endin</span>

<span class="oblock">instr</span> 99 <span class="comment">; global reverb		</span>
al, ar	<span class="opc">reverbsc</span> gaReverb, gaReverb, .8, 10000
	<span class="opc">outs</span>	gaReverb<span class="op">+</span>al, gaReverb<span class="op">+</span>ar
	
<span class="opc">clear</span>	gaReverb

<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span>1  0 3 1
<span class="stamnt">i</span>99 0 5
<span class="stamnt">e</span>

<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
      This is another example uses the vincr opcode. It uses the file <a class="ulink" href="examples/vincr-complex.csd" target="_top"><em class="citetitle">vincr-complex.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp164518304"></a>
          <p class="title">
            <strong>Example 1003. </strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac     <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if RT audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o vincr-complex.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

gaReverbSend <span class="opc">init</span> 0

<span class="oblock">instr</span> 1

iamp   <span class="op">=</span> p4
ifreq  <span class="op">=</span> p5
aenv   <span class="opc">linseg</span>  0.0, 0.1<span class="op">*</span>p3, iamp, 0.6<span class="op">*</span>p3, iamp, 0.3<span class="op">*</span>p3, 0.0
aosc   <span class="opc">poscil</span> aenv, ifreq, 1
       <span class="opc">vincr</span>   gaReverbSend, aosc
<span class="oblock">endin</span>


<span class="oblock">instr</span> 2	<span class="comment">; global reverb instrument</span>

al, ar <span class="opc">reverbsc</span> gaReverbSend, gaReverbSend, 0.85, 12000
       <span class="opc">outs</span>     gaReverbSend<span class="op">+</span>al, gaReverbSend<span class="op">+</span>ar
       <span class="opc">clear</span>    gaReverbSend
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span>1 0 4096 10 1

{ 4 CNT
  { 8 PARTIAL
      <span class="comment">;   start time     duration            amplitude          frequency     </span>
      <span class="stamnt">i</span>1  [0.5 * $CNT.]  [1 + ($CNT * 0.2)]  [.04 + (~ * .02)]  [800 + (200 * $CNT.) + ($PARTIAL. * 20)]
  }
}

<span class="stamnt">i</span>2 0 6
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp164519792"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="clear.html" title="clear"><em class="citetitle">clear</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp164521840"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Gabriel Maldonado</td>
          </tr>
          <tr>
            <td>Italy</td>
          </tr>
          <tr>
            <td>1999</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 3.56</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="vibrato.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="vlimit.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">vibrato </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> vlimit</td>
        </tr>
      </table>
    </div>
  </body>
</html>
